"""
des: pyqt布局的工具集
author: mr_52hz
date: 2021-02-01
"""
import os
import platform


def get_platform():
    platform_version = platform.platform(terse=True).lower()
    if 'windows' in platform_version:
        current_platform = 'windows'
    elif 'macos' in platform_version:
        current_platform = 'macos'
    else:
        current_platform = 'linux'

    return current_platform


def get_sys_documents_dir():

    current_platform = get_platform()

    envs = os.environ
    try:
        if current_platform == 'windows':
            documents_dir = os.path.join(envs['USERPROFILE'], 'Documents')
        else:
            documents_dir = os.path.join(envs['HOME'] + 'Documents')
    except Exception as e:
        documents_dir = None

    return documents_dir
